package com.example.springboot_rabbitmq.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitMQConfig {
    @Bean
    public Queue helloQueue() {
        return new Queue("spring_boot_hello_queue");
    }
    @Bean
        public Queue customQueue() {
           return new Queue("custom_queue");

    }
    @Bean
    public Queue pubSubQueue1() {
        return new Queue("pub_sub_queue1");
    }
    @Bean
    public Queue pubSubQueue2() {
        return new Queue("pub_sub_queue2");
    }
    @Bean
    public FanoutExchange pubSubExchange() {
        return new FanoutExchange("pub_sub_exchange");
    }






//    @Bean
//    public Binding binding1() {
//        return BindingBuilder.bind(pubSubQueue1()).to(pubSubExchange());
//    }
//    @Bean
//    public Binding binding2() {
//        return BindingBuilder.bind(pubSubQueue2()).to(pubSubExchange());
//    }

    @Bean
    public Queue topicQueue1() {
        return new Queue("topic_queue1");
    }
    @Bean
    public Queue topicQueue2() {
        return new Queue("topic_queue2");
    }
    @Bean
    public TopicExchange topicExchange() {
        return new TopicExchange("topic_exchange");
    }
    @Bean
    public Binding binding1() {
        return BindingBuilder.bind(topicQueue1()).to(topicExchange()).with("topic.key1.#");
    }
    @Bean
    public Binding binding2() {
        return BindingBuilder.bind(topicQueue2()).to(topicExchange()).with("topic.key2.*");
    }



}
